package com.mhc.suzuki.controller;

import com.alibaba.fastjson.JSON;
import com.mhc.haval.security.model.User;
import com.mhc.suzuki.bo.*;
import com.mhc.suzuki.constant.AnnexConstant;
import com.mhc.suzuki.constant.BizTypeEnum;
import com.mhc.suzuki.constant.CustomerTypeEnum;
import com.mhc.suzuki.constant.ErrorCodeEnum;
import com.mhc.suzuki.dal.model.CustomerDO;
import com.mhc.suzuki.exception.SuzukiCommonException;
import com.mhc.suzuki.form.*;
import com.mhc.suzuki.model.bo.CreditQueryApplyBO;
import com.mhc.suzuki.model.bo.OrderListBO;
import com.mhc.suzuki.service.ApplyService;
import com.mhc.suzuki.service.OrderGeneralInfoService;
import com.mhc.suzuki.service.OrderService;
import com.mhc.suzuki.util.BeanCopierUtil;
import com.mhc.suzuki.util.DateUtil;
import com.mhc.suzuki.util.UniqueIdGen;
import com.mhc.suzuki.vo.*;
import com.subaru.common.entity.BizResult;
import com.subaru.common.query.PageResult;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;

/**
 * Created by kanon on 17/8/11 19:18.
 */
@Slf4j
@RestController
@RequestMapping(value = "/order")     // 通过这里配置使下面的映射都在/order下，可去除
public class OrderController {

    @Autowired
    private OrderService orderService;


    @Autowired
    private OrderGeneralInfoService orderGeneralInfoService;

    @Autowired
    private ApplyService applyService;

    /**
     * 新建订单时生成订单号和附件批次号
     *
     * @return
     */
    @ApiOperation(value = "新建订单时生成订单号和附件批次号", notes = "新建订单时生成订单号和附件批次号")
    @RequestMapping(value = {"/uniqueKey"}, method = RequestMethod.POST)
    public BizResult<OrderNoVO> createOrderNo() {
        BizResult<OrderNoVO> result = new BizResult<>();
        OrderNoVO orderNoVO = new OrderNoVO();
        orderNoVO.setOrderNo(UniqueIdGen.genOrderNo(BizTypeEnum.CREDIT_CARD_INSTALLMENT.getAbbreviation()));
        orderNoVO.setAnnexBatchNo(UniqueIdGen.genUniqueId(AnnexConstant.ANNEX_BATCHNO_PREFIX));
        result.setData(orderNoVO);
        result.setSuccess(true);
        result.setMessage("生成订单号和附件批次号");
        return result;
    }

    /**
     * 提交订单(征信申请)
     *
     * @return
     */
    @ApiOperation(value = "提交订单（征信申请）", notes = "")
    @RequestMapping(value = {""}, method = RequestMethod.POST)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderAddForm", value = "提交订单实体orderAddForm", required = true, dataType = "OrderAddForm")
    })
    public BizResult<Boolean> addOrder(@AuthenticationPrincipal User logedUser, @RequestBody OrderAddForm orderAddForm) {
        log.info("orderAddForm:{}", JSON.toJSONString(orderAddForm));
        Optional<User> userOptional = Optional.ofNullable(logedUser);
        if (userOptional.isPresent()) {
            if (StringUtils.isBlank(orderAddForm.getOrderNo())) {
                return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
            }
            if (orderAddForm.getBankId() == null || new Integer(0).equals(orderAddForm.getBankId())) {
                return BizResult.create(ErrorCodeEnum.BANK_ISNULL.getErrCode(), ErrorCodeEnum.BANK_ISNULL.getErrMsg());
            }
            if (orderAddForm.getBemarried() == null) {
                return BizResult.create(ErrorCodeEnum.BE_MARRIED_ISNULL.getErrCode(), ErrorCodeEnum.BE_MARRIED_ISNULL.getErrMsg());
            }
            List<CreditQueryApplyBO> creditQueryApplyBOList = new ArrayList<>();
            List<OrderCreditAddForm> orderCreditAddFormList = orderAddForm.getOrderCreditAddFormList();
            //担保人数量
            int sponsorNum = 0;
            for (OrderCreditAddForm orderCreditAddForm : orderCreditAddFormList) {
                CreditQueryApplyBO creditQueryApplyBO = new CreditQueryApplyBO();

                if (CustomerTypeEnum.BUYER.getCode().equals(orderCreditAddForm.getCustomerType())) {
                    if (StringUtils.isBlank(orderCreditAddForm.getCustomerName().trim())) {
                        return BizResult.create(ErrorCodeEnum.BUYER_NAME_ISNULL.getErrCode(), ErrorCodeEnum.BUYER_NAME_ISNULL.getErrMsg());
                    }
                    if (StringUtils.isBlank(orderCreditAddForm.getIdCard().trim())) {
                        return BizResult.create(ErrorCodeEnum.BUYER_IDCARD_ISNULL.getErrCode(), ErrorCodeEnum.BUYER_IDCARD_ISNULL.getErrMsg());
                    }
                    creditQueryApplyBO.setBemarried(orderAddForm.getBemarried());

                }
                if (CustomerTypeEnum.COMMONBUYER.getCode().equals(orderCreditAddForm.getCustomerType())) {
                    if (StringUtils.isBlank(orderCreditAddForm.getCustomerName().trim())) {
                        return BizResult.create(ErrorCodeEnum.COMMON_BUYER_NAME_ISNULL.getErrCode(), ErrorCodeEnum.COMMON_BUYER_NAME_ISNULL.getErrMsg());
                    }
                    if (StringUtils.isBlank(orderCreditAddForm.getIdCard().trim())) {
                        return BizResult.create(ErrorCodeEnum.COMMON_BUYER_IDCARD_ISNULL.getErrCode(), ErrorCodeEnum.COMMON_BUYER_IDCARD_ISNULL.getErrMsg());
                    }
                    creditQueryApplyBO.setBemarried(orderAddForm.getBemarried());
                }

                if (CustomerTypeEnum.SPONSOR.getCode().equals(orderCreditAddForm.getCustomerType())) {
                    sponsorNum++;
                    if (StringUtils.isBlank(orderCreditAddForm.getCustomerName().trim())) {
                        return BizResult.create(ErrorCodeEnum.SPONSOR_NAME_ISNULL.getErrCode(), ErrorCodeEnum.SPONSOR_NAME_ISNULL.getErrMsg());
                    }
                    if (StringUtils.isBlank(orderCreditAddForm.getIdCard().trim())) {
                        return BizResult.create(ErrorCodeEnum.SPONSOR_IDCARD_ISNULL.getErrCode(), ErrorCodeEnum.SPONSOR_IDCARD_ISNULL.getErrMsg());
                    }

                }
                if (StringUtils.isBlank(orderCreditAddForm.getAnnexBatchNo())) {
                    return BizResult.create(ErrorCodeEnum.ANNEX_BATCH_NO_ISNULL.getErrCode(), ErrorCodeEnum.ANNEX_BATCH_NO_ISNULL.getErrMsg());
                }

                creditQueryApplyBO.setAnnexBatchNo(orderCreditAddForm.getAnnexBatchNo());
                creditQueryApplyBO.setBankName(orderAddForm.getBankName());
                creditQueryApplyBO.setBankId(orderAddForm.getBankId());
                creditQueryApplyBO.setCustomerName(orderCreditAddForm.getCustomerName());
                creditQueryApplyBO.setCustomerType(orderCreditAddForm.getCustomerType());
                creditQueryApplyBO.setIdCard(orderCreditAddForm.getIdCard());
                creditQueryApplyBO.setIdCardAddr(orderCreditAddForm.getIdCardAddr());
                creditQueryApplyBOList.add(creditQueryApplyBO);
            }
            if (sponsorNum > 5) {
                return BizResult.create(ErrorCodeEnum.SPONSOR_TOO_MORE.getErrCode(), ErrorCodeEnum.SPONSOR_TOO_MORE.getErrMsg());
            }
            orderService.addOrder(creditQueryApplyBOList, orderAddForm.getTerminalType(), orderAddForm.getOrderNo(), logedUser);
            return BizResult.create(Boolean.TRUE, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        } else {
            return BizResult.create(ErrorCodeEnum.SYS_ERROR.getErrCode(), "用户未登录");
        }
    }


    @ApiOperation(value = "订单列表", notes = "")
    @RequestMapping(value = "/orders", method = RequestMethod.GET)
    public BizResult<PageResult<OrderVO>> findOrderList(@AuthenticationPrincipal User logedUser, OrderListForm orderListForm) {
        log.info("orderListForm:{}", JSON.toJSONString(orderListForm));
        Optional<User> userOptional = Optional.ofNullable(logedUser);
        if (userOptional.isPresent()) {
            if (orderListForm.getPageNO() == null || orderListForm.getPageNO() == 0) {
                orderListForm.setPageNO(1);
            }
            if (orderListForm.getPageSize() == null || orderListForm.getPageSize() == 0) {
                orderListForm.setPageSize(10);
            }
            OrderListBO orderListBO = BeanCopierUtil.convert(orderListForm, OrderListBO.class);
            orderListBO.setStaffId(logedUser.getStaffId());
            orderListBO.setRoleList(logedUser.getRoleList());
            orderListBO.setStaffName(orderListForm.getStaffName());
            orderListBO.setDeptId(logedUser.getDeptId());
            orderListBO.setCompanyNo(logedUser.getCompanyNo());
            PageResult<OrderVO> orderVOPageResult = orderService.queryOrderList(orderListBO);
            if (orderVOPageResult.getTotalPage() > 0) {
                return BizResult.create(orderVOPageResult, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
            } else {
                return BizResult.create(null, ErrorCodeEnum.NO_DATA.getErrCode(), ErrorCodeEnum.NO_DATA.getErrMsg());
            }
        } else {
            return BizResult.create(ErrorCodeEnum.NOT_LOGIN.getErrCode(), ErrorCodeEnum.NOT_LOGIN.getErrMsg());
        }
    }


    /**
     * 订单购车人信息查询
     *
     * @param orderNo
     * @return
     */
    @ApiOperation(value = "订单购车人信息查询", notes = "点击tab页，显示购车人信息")
    @ApiImplicitParam(name = "orderNo", value = "订单编号", paramType = "path", required = true, dataType = "String")
    @RequestMapping(value = "/customerInfo/{orderNo}", method = RequestMethod.GET)
    public BizResult<CustomerInfoVO> getCustomerInfo(@PathVariable String orderNo) {
        if (StringUtils.isNotBlank(orderNo)) {
            //购车人信息查询
            CustomerInfoBO customerInfoBO = orderService.queryCustomerInfo(orderNo);

            /*BO-->VO*/
            CustomerInfoVO customerInfoVO = new CustomerInfoVO();
            OrderInfoVO orderInfo = new OrderInfoVO();
            CustomerVO customer = new CustomerVO();
            HouseInfoVO houseInfo = new HouseInfoVO();
            List<EmergencyContactVO> emergencyContacts = new ArrayList<>();
            BeanCopierUtil.copy(customerInfoBO.getCustomer(), customer);
            BeanCopierUtil.copy(customerInfoBO.getHouseInfo(), houseInfo);
            BeanCopierUtil.copy(customerInfoBO.getOrderInfo(), orderInfo);
            Iterator<EmergencyContactBO> iterator = customerInfoBO.getEmergencyContacts().iterator();
            while (iterator.hasNext()) {
                EmergencyContactBO emergencyContactBO = iterator.next();
                EmergencyContactVO emergencyContactVO = new EmergencyContactVO();
                BeanCopierUtil.copy(emergencyContactBO, emergencyContactVO);
                emergencyContacts.add(emergencyContactVO);
            }
            customerInfoVO.setEmergencyContacts(emergencyContacts);//紧急联系人
            customerInfoVO.setOrderInfo(orderInfo);//订单信息
            customerInfoVO.setCustomer(customer);//个人信息
            customerInfoVO.setHouseInfo(houseInfo);//房产信息
            return BizResult.create(customerInfoVO, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }
        return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
    }


    /**
     * 根据订单状态判断执行流程类型是否撤销或者修改
     *
     * @return
     */
    @ApiOperation(value = "根据订单状态判断执行流程类型是否撤销或者修改", notes = "")
    @RequestMapping(value = "/isOrderStatusByApproved/{orderNo}", method = RequestMethod.GET)
    @ApiImplicitParam(name = "orderNo", value = "订单编号", paramType = "path", required = true, dataType = "String")
    public BizResult<Boolean> isOrderStatusByApproved(@PathVariable String orderNo) {
        log.info("orderNo:{}", orderNo);
        try {
            Boolean result = applyService.isOrderStatusByApproved(orderNo);
            return BizResult.create(result, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        } catch (SuzukiCommonException e) {
            log.error("add order exception: " + e.getMessage(), e);
            return BizResult.create(ErrorCodeEnum.SYS_ERROR.getErrCode(), ErrorCodeEnum.SYS_ERROR.getErrMsg());
        }
    }


    /**
     * 购车人信息录入
     *
     * @param orderNo          订单号
     * @param customerInfoForm 购车人信息
     * @return
     */
    @ApiOperation(value = "订单购车人信息录入", notes = "点击保存，录入购车人信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderNo", value = "订单编号", paramType = "path", required = true, dataType = "String"),
            @ApiImplicitParam(name = "customerInfoForm", value = "购车人信息", paramType = "body", required = true, dataType = "CustomerInfoForm")
    })
    @RequestMapping(value = "/customerInfo/{orderNo}", method = RequestMethod.POST)
    public BizResult inputCustomerInfo(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody CustomerInfoForm customerInfoForm) {
        log.info("orderNo:{},customerInfoForm:{}", orderNo, customerInfoForm);
        CustomerInfoBO customerInfoBO = new CustomerInfoBO();
        if (StringUtils.isNotBlank(orderNo)) {
            /*Form转VO*/
            CustomerBO customerBO = new CustomerBO();//客户信息
            OrderInfoBO orderInfoBO = new OrderInfoBO();//订单信息
            HouseInfoBO houseInfoBO = new HouseInfoBO();//房产信息
            List<EmergencyContactBO> emergencyContactBOS = new ArrayList<>();//紧急联系人

            BeanCopierUtil.copy(customerInfoForm.getCustomer(), customerBO);
            BeanCopierUtil.copy(customerInfoForm.getOrderInfo(), orderInfoBO);
            BeanCopierUtil.copy(customerInfoForm.getHouseInfo(), houseInfoBO);
            Iterator<EmergencyContactForm> iterator = customerInfoForm.getEmergencyContacts().iterator();
            try {
                //职务学历设置
                String education = String.valueOf(customerInfoForm.getCustomer().getEducation());
                String job = String.valueOf(customerInfoForm.getCustomer().getJob());
                customerBO.setEducation(education);
                customerBO.setJob(job);

                //紧急联系人设置
                while (iterator.hasNext()) {
                    EmergencyContactBO emergencyContactBO = new EmergencyContactBO();
                    EmergencyContactForm emergencyContactForm = iterator.next();
                    BeanCopierUtil.copy(emergencyContactForm, emergencyContactBO);
                    //与购车人关系设置
                    String relationship = String.valueOf(emergencyContactForm.getRelationship());
                    emergencyContactBO.setRelationship(relationship);
                    emergencyContactBO.setCustomerId(customerBO.getCustomerId());
                    emergencyContactBOS.add(emergencyContactBO);
                }
            } catch (Exception e) {
                return BizResult.create(ErrorCodeEnum.PARAM_ERROR.getErrCode(), ErrorCodeEnum.PARAM_ERROR.getErrMsg());
            }

            customerBO.setStaffId(logedUser.getStaffId());
            customerInfoBO.setOrderInfo(orderInfoBO);
            customerInfoBO.setCustomer(customerBO);
            customerInfoBO.setHouseInfo(houseInfoBO);
            customerInfoBO.setEmergencyContacts(emergencyContactBOS);
        } else {
            return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
        }
        //购车人信息录入
        orderService.inputCustomerInfo(orderNo, customerInfoBO);
        return BizResult.create(Boolean.TRUE, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
    }


    /**
     * 订单共同购车人信息查询
     *
     * @param orderNo
     * @return
     */
    @ApiOperation(value = "订单共同购车人信息查询", notes = "点击tab页，显示共同购车人信息")
    @ApiImplicitParam(name = "orderNo", value = "订单编号", paramType = "path", required = true, dataType = "String")
    @RequestMapping(value = "/spouseInfo/{orderNo}", method = RequestMethod.GET)
    public BizResult<CustomerVO> getSpouseInfo(@PathVariable String orderNo) {
        log.info("orderNo:{}", orderNo);
        if (StringUtils.isNotBlank(orderNo)) {//共同购车人信息查询
            CustomerBO customerBO = orderService.querySpouseInfo(orderNo);
            if (customerBO == null) {//购车人未婚，共同购车人信息不存在
                return BizResult.create(null, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
            }
            CustomerVO customerVO = new CustomerVO();
            BeanCopierUtil.copy(customerBO, customerVO);
            return BizResult.create(customerVO, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }
        return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
    }


    /**
     * 订单共同购车人信息录入
     *
     * @param orderNo
     * @param customerForm 共同购车人信息
     * @return
     */
    @ApiOperation(value = "订单共同购车人信息录入", notes = "点击保存，录入共同购车人信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderNo", value = "订单编号", paramType = "path", required = true, dataType = "String"),
            @ApiImplicitParam(name = "customerForm", value = "共同购车人信息", paramType = "body", required = true, dataType = "CustomerForm")
    })
    @RequestMapping(value = "/spouseInfo/{orderNo}", method = RequestMethod.POST)
    public BizResult inputSpouseInfo(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody CustomerForm customerForm) {
        log.info("orderNo:{},customerForm:{}", orderNo, customerForm);
        if (StringUtils.isNotBlank(orderNo)) {
            CustomerBO customerBO = new CustomerBO();
            BeanCopierUtil.copy(customerForm, customerBO);
            try {
                //职务学历设置
                String education = String.valueOf(customerForm.getEducation());
                String job = String.valueOf(customerForm.getJob());
                customerBO.setEducation(education);
                customerBO.setJob(job);
            } catch (Exception e) {
                return BizResult.create(ErrorCodeEnum.PARAM_ERROR.getErrCode(), ErrorCodeEnum.PARAM_ERROR.getErrMsg());
            }
            customerBO.setStaffId(logedUser.getStaffId());
            if (orderService.inputSpouseInfo(orderNo, customerBO)) {
                return BizResult.create(Boolean.TRUE, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
            }
        }
        return BizResult.create(ErrorCodeEnum.PARAM_ERROR.getErrCode(), ErrorCodeEnum.PARAM_ERROR.getErrMsg());
    }


    /**
     * 订单担保人信息查询
     *
     * @param orderNo 订单编号查询
     * @return
     */
    @ApiOperation(value = "订单担保人信息查询", notes = "点击tab页，显示担保人信息")
    @ApiImplicitParam(name = "orderNo", value = "订单编号", paramType = "path", required = true, dataType = "String")
    @RequestMapping(value = "/underwriterInfo/{orderNo}", method = RequestMethod.GET)
    public BizResult<List<CustomerVO>> getUnderwriterInfo(@PathVariable String orderNo) {
        log.info("orderNo:{}", orderNo);
        if (StringUtils.isNotBlank(orderNo)) {//担保人信息查询
            List<CustomerDO> customerDOS = orderService.queryUnderwriter(orderNo);
            if (customerDOS == null) {
                return BizResult.create(null, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
            }
            /*DO-->VO*/
            List<CustomerVO> customerVOS = new ArrayList<>();
            Iterator<CustomerDO> iterator = customerDOS.iterator();
            while (iterator.hasNext()) {
                CustomerVO customerVO = new CustomerVO();
                CustomerDO customerDO = iterator.next();
                BeanCopierUtil.copy(customerDO, customerVO);
                customerVOS.add(customerVO);
            }
            return BizResult.create(customerVOS, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }
        return BizResult.create(ErrorCodeEnum.PARAM_ERROR.getErrCode(), ErrorCodeEnum.PARAM_ERROR.getErrMsg());
    }


    /**
     * 订单担保人信息录入
     *
     * @param orderNo
     * @param customerForms 担保人信息
     * @return
     */
    @ApiOperation(value = "订单担保人信息录入", notes = "点击保存，录入担保人信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderNo", value = "订单编号", paramType = "path", required = true, dataType = "String"),
            @ApiImplicitParam(name = "customerForms", value = "购车人信息", paramType = "body", required = true, dataType = "List")
    })
    @RequestMapping(value = "/underwriterInfo/{orderNo}", method = RequestMethod.POST)
    public BizResult inputUnderwriterInfo(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody List<CustomerForm> customerForms) {

        if (!customerForms.isEmpty()) {
            List<CustomerBO> customerBOS = new ArrayList<>();
            for (CustomerForm customerForm : customerForms) {
                CustomerBO customerBO = new CustomerBO();
                BeanCopierUtil.copy(customerForm, customerBO);
                try {
                    //职务学历设置
                    String education = String.valueOf(customerForm.getEducation());
                    String job = String.valueOf(customerForm.getJob());
                    customerBO.setJob(job);
                    customerBO.setEducation(education);
                } catch (Exception e) {
                    return BizResult.create(ErrorCodeEnum.PARAM_ERROR.getErrCode(), ErrorCodeEnum.PARAM_ERROR.getErrMsg());
                }
                customerBO.setStaffId(logedUser.getStaffId());
                customerBOS.add(customerBO);
            }
            if (orderService.inputUnderwriterInfo(orderNo, customerBOS)) {
                return BizResult.create(Boolean.TRUE, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
            }
        } else {
            return BizResult.create(null, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }
        return BizResult.create(ErrorCodeEnum.PARAM_ERROR.getErrCode(), ErrorCodeEnum.PARAM_ERROR.getErrMsg());
    }


    /**
     * 综合处理页面信息获取信息查询
     *
     * @param orderNo 订单编号
     * @return
     */
    @ApiOperation(value = "综合处理信息页面", notes = "点击综合处理tab页跳转至这处理页面")
    @ApiImplicitParam(name = "orderNo", value = "订单编号", paramType = "path", required = true, dataType = "String")
    @RequestMapping(value = "/generalInfo/{orderNo}", method = RequestMethod.GET)
    public @ResponseBody
    BizResult<GeneralOrderInfoVO> orderGeneralInfo(@PathVariable(value = "orderNo") String orderNo) {

        GeneralOrderInfoBO generalOrderInfoBO;
        if (StringUtils.isNotBlank(orderNo)) {
            generalOrderInfoBO = orderGeneralInfoService.getGeneralOrderInfoByOrderNo(orderNo);
        } else {
            return BizResult.create(ErrorCodeEnum.PARAM_ERROR.getErrCode(), ErrorCodeEnum.PARAM_ERROR.getErrMsg());
        }
        GeneralOrderInfoVO generalOrderInfoVO = new GeneralOrderInfoVO();
        OrderLoanInfoVO orderLoanInfoVO = new OrderLoanInfoVO();
        GeneralAccidentVO generalAccidentVO = new GeneralAccidentVO();
        GeneralCarInfoVO generalCarInfoVO = new GeneralCarInfoVO();
        GeneralContractSubmitVO generalContractSubmitVO = new GeneralContractSubmitVO();
        GeneralLoanClearVO generalLoanClearVO = new GeneralLoanClearVO();
        GeneralNotaryMortgageVO generalNotaryMortgageVO = new GeneralNotaryMortgageVO();
        GeneralPostBankCardVO generalPostBankCardVO = new GeneralPostBankCardVO();
        GeneralRefundDepositVO generalRefundDepositVO = new GeneralRefundDepositVO();
        List<GeneralInsuranceInfoVO> generalInsuranceInfoVOS = new ArrayList<>();

        BeanCopierUtil.copy(generalOrderInfoBO.getLoanInfo(), orderLoanInfoVO);
        BeanCopierUtil.copy(generalOrderInfoBO.getAccident(), generalAccidentVO);
        BeanCopierUtil.copy(generalOrderInfoBO.getCarInfo(), generalCarInfoVO);
        BeanCopierUtil.copy(generalOrderInfoBO.getContractSubmit(), generalContractSubmitVO);
        BeanCopierUtil.copy(generalOrderInfoBO.getLoanClear(), generalLoanClearVO);
        BeanCopierUtil.copy(generalOrderInfoBO.getRefundDeposit(), generalRefundDepositVO);
        BeanCopierUtil.copy(generalOrderInfoBO.getPostBankCardForm(), generalPostBankCardVO);
        BeanCopierUtil.copy(generalOrderInfoBO.getNotaryMortgage(), generalNotaryMortgageVO);
        if(!CollectionUtils.isEmpty(generalOrderInfoBO.getInsurance())){
            Iterator<GeneralInsuranceInfoBO> iterator = generalOrderInfoBO.getInsurance().iterator();
            while (iterator.hasNext()) {
                GeneralInsuranceInfoBO insuranceInfoBO = iterator.next();
                GeneralInsuranceInfoVO generalInsuranceInfoVO = new GeneralInsuranceInfoVO();
                BeanCopierUtil.copy(insuranceInfoBO, generalInsuranceInfoVO);
                generalInsuranceInfoVOS.add(generalInsuranceInfoVO);
            }
        }
        generalOrderInfoVO.setLoanInfo(orderLoanInfoVO);
        generalOrderInfoVO.setAccident(generalAccidentVO);
        generalOrderInfoVO.setLoanClear(generalLoanClearVO);
        generalOrderInfoVO.setRefundDeposit(generalRefundDepositVO);
        generalOrderInfoVO.setPostBankCardForm(generalPostBankCardVO);
        generalOrderInfoVO.setNotaryMortgage(generalNotaryMortgageVO);
        generalOrderInfoVO.setCarInfo(generalCarInfoVO);
        generalOrderInfoVO.setContractSubmit(generalContractSubmitVO);
        generalOrderInfoVO.setInsurance(generalInsuranceInfoVOS);
        return BizResult.create(generalOrderInfoVO, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
    }


    /**
     * 综合处理出险信息录入
     *
     * @param orderNo
     * @param accidentForm
     * @return
     */
    @ApiOperation(value = "综合处理出险信息录入", notes = "点击录入，存储综合处理出险信息")
    @ApiImplicitParam(name = "accidentForm", value = "出险信息", paramType = "body", required = true, dataType = "AccidentForm")
    @RequestMapping(value = "/generalInfo/accident/{orderNo}", method = RequestMethod.POST)
    public @ResponseBody
    BizResult inputAccidentInfo(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody AccidentForm accidentForm) {
        try {
            log.info("orderNo:{},accidentForm:{}", orderNo, accidentForm);
            if (StringUtils.isBlank(orderNo)) {
                log.error("订单号为空...");
                return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
            }
            GeneralAccidentBO generalAccidentBO = new GeneralAccidentBO();
            BeanCopierUtil.copy(accidentForm, generalAccidentBO);
            generalAccidentBO.setOrderNo(orderNo);
            generalAccidentBO.setStaffId(logedUser.getStaffId());
            generalAccidentBO.setAccidentDate(DateUtil.defaultParseStringToDateTime(accidentForm.getAccidentDate()));
            Boolean insertFlag = orderGeneralInfoService.inputAccidentInfo(generalAccidentBO);
            return BizResult.create(insertFlag, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }catch (SuzukiCommonException e) {
            log.error("inputAccidentInfo SuzukiCommonException,订单号："+orderNo,e);
            return BizResult.create(e.getCode(),e.getMessage());
        }
    }


    /**
     * 综合处理车辆信息录入
     *
     * @param orderNo
     * @param carInfoForm
     * @return
     */
    @ApiOperation(value = "综合处理车辆信息录入", notes = "点击录入，存储综合处理车辆信息")
    @ApiImplicitParam(name = "carInfoForm", value = "车辆信息", paramType = "body", required = true, dataType = "CarInfoForm")
    @RequestMapping(value = "/generalInfo/carInfo/{orderNo}", method = RequestMethod.POST)
    public @ResponseBody
    BizResult inputCarInfo(@PathVariable String orderNo, @RequestBody CarInfoForm carInfoForm) {
        try {
            log.info("orderNo:{},carInfoForm:{}", orderNo, carInfoForm);
            if (StringUtils.isBlank(orderNo)) {
                log.error("订单号为空...");
                return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
            }
            GeneralCarInfoBO generalCarInfoBO = new GeneralCarInfoBO();
            BeanCopierUtil.copy(carInfoForm, generalCarInfoBO);
            generalCarInfoBO.setOrderNo(orderNo);
            Boolean insertFlag = orderGeneralInfoService.inputCarInfo(generalCarInfoBO);
            return BizResult.create(insertFlag, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }catch (SuzukiCommonException e) {
            log.error("inputCarInfo SuzukiCommonException,订单号："+orderNo,e);
            return BizResult.create(e.getCode(),e.getMessage());
        }

    }


    /**
     * 综合处理公证抵押录入
     *
     * @param orderNo
     * @param notaryMortgageForm
     * @return
     */
    @ApiOperation(value = "综合处理公证抵押录入", notes = "点击录入，存储综合处理公证抵押")
    @ApiImplicitParam(name = "notaryMortgageForm", value = "公证抵押信息", paramType = "body", required = true, dataType = "NotaryMortgageForm")
    @RequestMapping(value = "/generalInfo/notaryMortgage/{orderNo}", method = RequestMethod.POST)
    public @ResponseBody
    BizResult inputNotaryMortgage(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody NotaryMortgageForm notaryMortgageForm) {
        try{
            log.info("orderNo:{},notaryMortgageForm:{}", orderNo, notaryMortgageForm);
            if (StringUtils.isBlank(orderNo)) {
                log.error("订单号为空...");
                return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
            }
            GeneralNotaryMortgageBO generalNotaryMortgageBO = new GeneralNotaryMortgageBO();
            BeanCopierUtil.copy(notaryMortgageForm, generalNotaryMortgageBO);
            generalNotaryMortgageBO.setOrderNo(orderNo);
            generalNotaryMortgageBO.setStaffId(logedUser.getStaffId());
            generalNotaryMortgageBO.setRegistryDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getRegistryDate()));//上牌登记日期
            generalNotaryMortgageBO.setNotarSubmitDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getNotarSubmitDate()));//公证书送交日期
            generalNotaryMortgageBO.setNotarReceiptDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getNotarReceiptDate()));//收到公证书日期
            generalNotaryMortgageBO.setNotarPostDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getNotarPostDate()));//公证书寄外地日期
            generalNotaryMortgageBO.setRegCertReceiptDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getRegCertReceiptDate()));//登记证书和发票收到日期
            generalNotaryMortgageBO.setSubmitBankDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getSubmitBankDate()));//抵押材料送交银行日
            generalNotaryMortgageBO.setMrgeDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getMrgeDate()));//办理抵押日期
            generalNotaryMortgageBO.setBorrowRegCertDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getBorrowRegCertDate()));//借登记证书日期
            generalNotaryMortgageBO.setMrgeSendCarAdminDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getMrgeSendCarAdminDate()));//抵押送交车管所日期
            generalNotaryMortgageBO.setMrgeBackDate(DateUtil.defaultParseStringToDateTime(notaryMortgageForm.getMrgeBackDate()));//抵押从车管所领回日期
            Boolean insertFlag = orderGeneralInfoService.inputNotaryMortgage(generalNotaryMortgageBO);
            return BizResult.create(insertFlag, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }catch (SuzukiCommonException e) {
            log.error("inputNotaryMortgage SuzukiCommonException,订单号："+orderNo,e);
            return BizResult.create(e.getCode(),e.getMessage());
        }
    }


    /**
     * 综合处理合同齐全信息录入
     *
     * @param orderNo
     * @param contractSubmitForm
     * @return
     */
    @ApiOperation(value = "综合处理合同齐全信息录入", notes = "点击录入，存储综合处理合同齐全信息")
    @ApiImplicitParam(name = "contractSubmitForm", value = "合同齐全信息", paramType = "body", required = true, dataType = "ContractSubmitForm")
    @RequestMapping(value = "/generalInfo/contractSubmit/{orderNo}", method = RequestMethod.POST)
    public @ResponseBody
    BizResult inputContractSubmit(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody ContractSubmitForm contractSubmitForm) {
        try {
            log.info("orderNo:{},contractSubmitForm:{}", orderNo, contractSubmitForm);
            if (StringUtils.isBlank(orderNo)) {
                log.info("订单号为空...");
                return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
            }
            GeneralContractSubmitBO generalContractSubmitBO = new GeneralContractSubmitBO();
            BeanCopierUtil.copy(contractSubmitForm, generalContractSubmitBO);
            generalContractSubmitBO.setOrderNo(orderNo);
            generalContractSubmitBO.setStaffId(logedUser.getStaffId());
            //日期格式变化
            generalContractSubmitBO.setSubmitDate(DateUtil.defaultParseStringToDateTime(contractSubmitForm.getSubmitDate()));//贷款资料递交银行日期
            generalContractSubmitBO.setCompleteDate(DateUtil.defaultParseStringToDateTime(contractSubmitForm.getCompleteDate()));//合同齐全日期
            Boolean insertFlag = orderGeneralInfoService.inputCotractSubmit(generalContractSubmitBO);
            return BizResult.create(insertFlag,ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        } catch (SuzukiCommonException e) {
            log.error("inputContractSubmit SuzukiCommonException,订单号："+orderNo,e);
            return BizResult.create(e.getCode(),e.getMessage());
        }
    }


    /**
     * 综合处理寄卡信息录入
     *
     * @param orderNo
     * @param postBankCardForm
     * @return
     */
    @ApiOperation(value = "综合处理寄卡信息录入", notes = "点击录入，存储综合处理寄卡信息")
    @ApiImplicitParam(name = "postBankCardForm", value = "综合信息", paramType = "body", required = true, dataType = "postBankCardForm")
    @RequestMapping(value = "/generalInfo/postBankCard/{orderNo}", method = RequestMethod.POST)
    public @ResponseBody
    BizResult inputPostBankCard(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody PostBankCardForm postBankCardForm) {
        try {

            log.info("orderNo:{},postBankCardForm:{}", orderNo, postBankCardForm);
            if (StringUtils.isBlank(orderNo)) {
                log.info("订单号为空...");
                return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
            }
            GeneralPostBankCardBO generalPostBankCardBO = new GeneralPostBankCardBO();
            BeanCopierUtil.copy(postBankCardForm, generalPostBankCardBO);
            generalPostBankCardBO.setOrderNo(orderNo);
            generalPostBankCardBO.setStaffId(logedUser.getStaffId());
            generalPostBankCardBO.setPostDate(DateUtil.defaultParseStringToDateTime(postBankCardForm.getPostDate()));//还款卡寄出日期
            Boolean insertFlag = orderGeneralInfoService.inputPostBankCard(generalPostBankCardBO);
            return BizResult.create(insertFlag, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }catch (SuzukiCommonException e) {
            log.error("inputPostBankCard SuzukiCommonException,订单号："+orderNo,e);
            return BizResult.create(e.getCode(),e.getMessage());
        }

    }


    /**
     * 综合处理退保证金信息录入
     *
     * @param orderNo
     * @param refundDepositForm
     * @return
     */
    @ApiOperation(value = "综合处理退保证金信息录入", notes = "点击录入，存储综合处理退保证金信息")
    @ApiImplicitParam(name = "refundDepositForm", value = "退保证金信息", paramType = "body", required = true, dataType = "RefundDepositForm")
    @RequestMapping(value = "/generalInfo/depositForm/{orderNo}", method = RequestMethod.POST)
    public @ResponseBody
    BizResult inputRefundDeposit(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody RefundDepositForm refundDepositForm) {
        try {
            log.info("orderNo:{},refundDepositForm:{}", orderNo, refundDepositForm);
            if (StringUtils.isBlank(orderNo)) {
                log.info("订单号为空...");
                return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
            }
            GeneralRefundDepositBO generalRefundDepositBO = new GeneralRefundDepositBO();
            BeanCopierUtil.copy(refundDepositForm, generalRefundDepositBO);
            generalRefundDepositBO.setOrderNo(orderNo);
            generalRefundDepositBO.setStaffId(logedUser.getStaffId());
            Boolean insertFlag = orderGeneralInfoService.inputRefundDeposit(generalRefundDepositBO);
            return BizResult.create(insertFlag, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }catch (SuzukiCommonException e) {
            log.error("inputRefundDeposit SuzukiCommonException,订单号："+orderNo,e);
            return BizResult.create(e.getCode(),e.getMessage());
        }

    }


    /**
     * 综合处理结清信息录入
     * @param orderNo
     * @param loanClearForm
     * @return
     */
    @ApiOperation(value = "综合处理结清信息录入", notes = "点击录入，存储综合处理结清信息")
    @ApiImplicitParam(name = "loanClearForm", value = "结清信息", paramType = "body", required = true, dataType = "LoanClearForm")
    @RequestMapping(value = "/generalInfo/loanClear/{orderNo}", method = RequestMethod.POST)
    public @ResponseBody
    BizResult inputLoanClear(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody LoanClearForm loanClearForm) {
       try {
           log.info("orderNo:{},loanClearForm:{}", orderNo, loanClearForm);
           if (StringUtils.isBlank(orderNo)) {
               log.info("订单号为空...");
               return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
           }
           GeneralLoanClearBO generalLoanClearBO = new GeneralLoanClearBO();
           BeanCopierUtil.copy(loanClearForm, generalLoanClearBO);
           generalLoanClearBO.setOrderNo(orderNo);
           generalLoanClearBO.setStaffId(logedUser.getStaffId());
           generalLoanClearBO.setAdvanceSettleDate(DateUtil.defaultParseStringToDateTime(loanClearForm.getAdvanceSettleDate()));
           generalLoanClearBO.setNormalSettleDate(DateUtil.defaultParseStringToDateTime(loanClearForm.getNormalSettleDate()));
           Boolean insertFlag = orderGeneralInfoService.inputLoanClear(generalLoanClearBO);
           return BizResult.create(insertFlag, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
       }catch (SuzukiCommonException e) {
           log.error("inputLoanClear SuzukiCommonException,订单号："+orderNo,e);
           return BizResult.create(e.getCode(),e.getMessage());
       }


    }


    /**
     * 综合处理保险信息录入
     *
     * @param orderNo
     * @param insuranceInfoForms
     * @return
     */
    @ApiOperation(value = "综合处理保险信息录入", notes = "点击录入，存储综合保险处理信息")
    @ApiImplicitParam(name = "insuranceInfoForm", value = "保险信息", paramType = "body", required = true, dataType = "InsuranceInfoForm")
    @RequestMapping(value = "/generalInfo/Insurance/{orderNo}", method = RequestMethod.POST)
    public @ResponseBody
    BizResult inputInsurance(@AuthenticationPrincipal User logedUser, @PathVariable String orderNo, @RequestBody List<InsuranceInfoForm> insuranceInfoForms) {
       try {
           log.info("orderNo:{},insuranceInfoForms:{}", orderNo, insuranceInfoForms);
           if (StringUtils.isBlank(orderNo)) {
               log.error("订单号为空...");
               return BizResult.create(ErrorCodeEnum.ORDER_NO_ISNULL.getErrCode(), ErrorCodeEnum.ORDER_NO_ISNULL.getErrMsg());
           } else if (logedUser == null) {
               log.error("账号未登录无法操作...");
               return BizResult.create(ErrorCodeEnum.NOT_LOGIN.getErrCode(), ErrorCodeEnum.NOT_LOGIN.getErrMsg());
           }
           List<GeneralInsuranceInfoBO> generalInsuranceInfoBOS = new ArrayList<>();
           for (InsuranceInfoForm insuranceInfoForm : insuranceInfoForms) {
               GeneralInsuranceInfoBO generalInsuranceInfoBO = new GeneralInsuranceInfoBO();
               BeanCopierUtil.copy(insuranceInfoForm, generalInsuranceInfoBO);
               generalInsuranceInfoBO.setOrderNo(orderNo);
               generalInsuranceInfoBO.setStaffId(logedUser.getStaffId());
               //时间格式转换
               generalInsuranceInfoBO.setEffectiveDate(DateUtil.defaultParseStringToDateTime(insuranceInfoForm.getEffectiveDate()));
               generalInsuranceInfoBO.setExpiryDate(DateUtil.defaultParseStringToDateTime(insuranceInfoForm.getExpiryDate()));
               generalInsuranceInfoBOS.add(generalInsuranceInfoBO);
           }
           Boolean insertFlag = orderGeneralInfoService.inputInsurance(generalInsuranceInfoBOS);
           log.info("保险信息录入完成...");
           return BizResult.create(insertFlag, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
       }catch (SuzukiCommonException e){
           log.error("inputInsurance SuzukiCommonException,订单号："+orderNo,e);
           return BizResult.create(e.getCode(),e.getMessage());
       }

    }


    /**
     * 综合处理选择保险公司
     * @param dataDictForm
     * @param logedUser
     * @return
     */
    @ApiOperation(value = "综合处理选择保险公司", notes = "选择综合保险公司")
    @RequestMapping(value = "/generalInfo/selectByInsurance", method = RequestMethod.GET)
    public BizResult selectByInsurance(DataDictForm dataDictForm,@AuthenticationPrincipal User logedUser) {
        try {
            DataDictBO dataDictBO = new DataDictBO();
            BeanUtils.copyProperties(dataDictForm, dataDictBO);
            List<DataDictVO> insuranceCompanyList = orderGeneralInfoService.getInsuranceCompanyList(dataDictBO,logedUser);
            return BizResult.create(insuranceCompanyList,ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        }catch (SuzukiCommonException e){
            log.error("selectByInsurance SuzukiCommonException",e);
            return BizResult.create(e.getCode(),e.getMessage());
        }
    }








    /**
     * 修改订单状态
     *
     * @return
     */
    @ApiOperation(value = "修改订单状态", notes = "")
    @RequestMapping(value = "/changeOrderStatus", method = RequestMethod.POST)
    @ApiImplicitParam(name = "orderInfoForm", value = "提交订单信息", required = false, paramType = "body", dataType = "OrderInfoForm")
    public BizResult<Boolean> changeOrderStatus(@RequestBody OrderInfoForm orderInfoForm) {
        log.info("orderNo:{},", orderInfoForm);
        try {
            OrderInfoBO orderInfoBO = new OrderInfoBO();
            BeanUtils.copyProperties(orderInfoForm, orderInfoBO);
            Boolean result = orderService.changeOrderStatus(orderInfoBO.getOrderNo(), orderInfoBO.getOrderStatus());
            return BizResult.create(result, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
        } catch (Exception e) {
            log.error("add order exception: " + e.getMessage(), e);
            return BizResult.create(ErrorCodeEnum.SYS_ERROR.getErrCode(), ErrorCodeEnum.SYS_ERROR.getErrMsg());
        }
    }


    /**
     * 审核页面客户信息获取
     *
     * @param applyId
     * @return
     */
    @ApiOperation(value = "审核页面客户信息获取", notes = "根据订单号获取审核页面客户信息")
    @RequestMapping(value = "/auditCustomer/{applyId}", method = RequestMethod.GET)
    public BizResult<AuditCustomerVO> changeOrderStatus(@PathVariable Long applyId) {
        log.info("applyId:{},", applyId);
        if (applyId == null) {
            return BizResult.create(ErrorCodeEnum.PARAM_ERROR.getErrCode(), ErrorCodeEnum.PARAM_ERROR.getErrMsg());
        }
        AuditCustomerBO auditCustomerBO = orderService.getAuditCustomer(applyId);
        AuditCustomerVO auditCustomerVO = BeanCopierUtil.convert(auditCustomerBO, AuditCustomerVO.class);
        return BizResult.create(auditCustomerVO, true, ErrorCodeEnum.SUCCESS.getErrCode(), ErrorCodeEnum.SUCCESS.getErrMsg());
    }

}

